import Vue from 'vue'
import Vuex from 'vuex'
//引入自定义主题文件
import autoThemes from '../utils/autoThemes.js'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    //用于黑白主题切换
    themeName:"dark",
    //自定义主题
    autoTheme:autoThemes("dark")
  },
  mutations: {
    //修改主题
    changeTheme(state){
      //切换黑白主题
      state.themeName = state.themeName == 'dark' ? 'vintage' :"dark"
      //自定义主题跟随黑白主题变化
      state.autoTheme = autoThemes(state.themeName)
    }
  },
  actions: {
  },
  modules: {
  }
})
